export default eventHandler((event) => {
  // const token = getHeader(event, 'Authorization');
  // if (!token) {
  //   setResponseStatus(event, 401);
  //   return useResponseError('UnauthorizedException', 'Unauthorized Exception');
  // }
  //
  // const username = Buffer.from(token, 'base64').toString('utf8');
  const username = 'vben';
  const {pageQuery} = readBody(event);
  console.log("wwwww")
  const mockData = [
    {projectCode: "10001", projectName: '赫兹运力11', projectStatus: 'enable', appId: 'APP00000001', projectLeader: '毛利', mailMonitor: 'maoli521314@163.com', description: '这是赫兹运力的描述',
      createTime: '2024:08:10 10:16:12',
      updateTime: '2024:08:15 12:27:32',
      url: 'https://vxetable.cn/'
    },
    {projectCode: "10002", projectName: '赫兹工程', projectStatus: 'forbidden', appId: 'APP00000002', projectLeader: '毛利', mailMonitor: 'maoli521314@163.com', description: '这是这是赫兹工程的描述这是赫兹工程的描述这是赫兹工程的描述这是赫兹工程的描述这是赫兹工程的描述这是赫兹工程的描述这是赫兹工程的描述这是赫兹工程的描述这是赫兹工程的描述这是赫兹工程的描述这是赫兹工程的描述这是赫兹工程的描述这是赫兹工程的描述赫兹工程的描述',
      createTime: '2024:08:10 10:16:12',
      updateTime: '2024:08:15 12:27:32',
      url: 'https://vxetable.cn/'
    },
    {projectCode: "10003", projectName: '赫兹金融', projectStatus: 'pause', appId: 'APP00000003', projectLeader: '毛利', mailMonitor: 'maoli521314@163.com', description: '这是赫兹金融的描述',
      createTime: '2024:08:10 10:16:12',
      updateTime: '2024:08:15 12:27:32',
      url: 'https://vxetable.cn/'
    },
  ]
  class Page {
    total: number;
    currentPage: number;
    pageSize: number;
    constructor(total: number, currentPage: number, pageSize: number) {
      this.total = total;
      this.currentPage = currentPage;
      this.pageSize = pageSize;
    }
  };
  class Result {
    list: any;
    page: Page;
    result: any;
    constructor(list: any, page: Page, result: any) {
      this.list = list;
      this.page = page;
      this.result = result;
    }
  }
  const pageData = new Page(mockData.length, 1, 10);
  const result = new Result(mockData, pageData, mockData.slice((pageData.currentPage - 1) * pageData.pageSize, pageData.currentPage * pageData.pageSize));
  return useResponseSuccess(result);
});
